<div id="breadcrumb">
    <a onclick="javascript:history.go(-1);" class="go-to-home tip-bottom font font18" style="cursor: pointer;">
        <i class="icon-arrow-left"></i> 返回 &nbsp;
    </a>
    <a onclick="javascript:history.go(-1);" class="font font18" style="cursor: pointer;"> &nbsp;&nbsp;<span>水军 &gt</span></a>
    <a href="/agent/familyinfo?id={{info['id']}}" class="current font font18"> <span>账号详情</span></a>
    <input type="hidden" id="familyId" value="{{info['id']}}">
</div>
<!--sidebar-menu-->
<div id="sidebar" class="clearfix">
    <div class="user-info">
        <img alt="" src="{{userInfo['avatar']}}">

        <p>
            <span class="font font20 cr-dpe">{{userInfo['nickName']}}</span>
        </p>
        <p>
            <span class="font font20 cr-dpe">（{{userInfo['uid']}}）</span>
            <input id="in_uid" type="hidden" value="{{userInfo['uid']}}">
        </p>
        <p>
            <span class="i-actor sprite-fh_level fh{{userInfo['level']}}" style="margin-top: 5px;"></span><span class="font font20 cr-dpe" style="vertical-align: text-bottom;">{{userInfo['name']}}</span>
        </p>
    </div>
    <div class="progtrckr-box" style="top: 245px;">
        <div class="progtrckrline" style="height: 70px;"></div>
        <ul class="progtrckr">
            <li class="active"><i class="custom-icon custom-icon-point"></i><a href="/pull/accountinfo?uid={{userInfo['uid']}}">聊天记录</a></li>
            <li><i class="custom-icon custom-icon-point"></i><a href="/pull/accountstatistics?uid={{userInfo['uid']}}">统计</a></li>
        </ul>
    </div>
</div>
<!--end sidebar-menu-->

<div id="applyinfo_content" style="  margin-left: 230px;">
    <div class="container-fluid" style="padding: 0;">
        <div class="widget-box tab-tabs" >
            <div class="widget-title">

            </div>
            <div class="widget-content tab-content">
                <div id="tab1" class="tab-pane active">
                    <div class="container-fluid">
                        <div class="row-fluid" style="margin: 20px 0;overflow: hidden;">
                            <form action="/ajax/chatInfo" method="post">
                                <input type="hidden" value="1" name="isExcel">
                                <input type="hidden" value="{{userInfo['uid']}}" name="uid">
                                <input type="hidden" value="" name="startTime" id="_startTime">
                                <input type="hidden" value="" name="stopTime" id="_stopTime">
                                <input type="hidden" value="1" name="page" id="_page">
                                <input type="hidden" value="20" name="pageSize">
                                <button type="submit" class="btn btn-purple pull-right">导出表格</button>
                                <a class="date-calendar pull-right" style="margin-right: 10px;"><i class=" icon-calendar"></i> <input name="excelTime" id="mydate" placeholder="请输入日期" value="" style="height: 34px;"></a>
                            </form>
                        </div>

                        <div class="row-fluid">
                            <table id="tableList" class="table with-check table-purple">
                                <thead>
                                <tr>
                                    <th>发言时间</th>
                                    <th>所在直播间</th>
                                    <th>发言内容</th>
                                </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
                        </div>

                        {% include "common/pagination.html" %}
                    </div>
                </div>


            </div>
        </div>

    </div>
</div>
<link rel="stylesheet" href="{{static_url('web/css/icon/style-icon.css')}}">
<script src="{{static_url('web/js/daterangepicker.jQuery.js')}}"></script>
<link rel="stylesheet" href="{{static_url('web/css/ui.daterangepicker.css')}}">
<script type="text/javascript">

    $(function(){
        $('body').addClass('anchorinfo');

        getDataList();
        $('#mydate').daterangepicker({
                    presetRanges:[
                        //{text:'最近一周', dateStart:'yesterday-7days', dateEnd:'yesterday' },
                        //{text:'最近一月', dateStart:'yesterday-1month', dateEnd:'yesterday' },
                        //{text:'最近一年', dateStart:'yesterday-1year', dateEnd:'yesterday' }
                    ],
                    presets:{
                        dateRange:'自定义时间'
                    },
                    rangeStartTitle:'起始日期',
                    rangeEndTitle:'结束日期',
                    nextLinkText:'下月',
                    prevLinkText:'上月',
                    doneButtonText:'确定',
                    cancelButtonText:'取消',
                    earliestDate:'',
                    latestDate:Date.parse('today'),
                    constrainDates:true,
                    rangeSplitter:'-',
                    dateFormat:'yy-mm-dd',
                    closeOnSelect:false,
                    onOpen:function(){
                        $('.ui-daterangepicker-dateRange').click().parent().hide();
                        $('.ui-daterangepickercontain').css({left:($('#mydate').offset().left-220)+'px'});
                    },
                    onClose:function(){
//                        var typer=$('#mydate').attr('data');
                        getDataList();
                        var b=$('#mydate').val();
                        var timeBegin= b.substring(0,10);
                        var timeEnd= b.substring(12,23);
                        $('#_startTime').val(timeBegin);
                        $('#_stopTime').val(timeEnd);

                    }
                }
        );
    });

   function getDataList(index){

       var b=$('#mydate').val();
       var timeBegin= b.substring(0,10);
       var timeEnd= b.substring(12,23);

       var data={};
       data.page=index||1;
       data.pageSize=global.pageSize;
       data.uid=$('#in_uid').val();
       data.startTime=timeBegin;
       data.stopTime=timeEnd;
       data.isExcel=0;

       $.ajax({
           type:"POST",
           data:data,
           url:'/ajax/chatInfo',
           dataType:'json',
           success:function(res){
               var data=res.data;
               var tableList=document.getElementById("tableList");
               var tbody= tableList.getElementsByTagName('tbody')[0];
               dataTable.clearData(tbody);

               var count=document.getElementById('count');
               count.innerHTML=data.count;

               for(var i=0;i<data.list.length;i++){
                   addRow(tbody,data.list[i]);
               }
               if(!index||index==0){
                   utilsPagination("#pagination",data.count,global.pageSize,function(page_index,jq){
                       page_index+=1;
                       $('#_page').val(page_index);
                       getDataList(page_index);
                   });
               }
           }
       });
   }


    function addRow(table,data){
        var row=table.insertRow();
        var cell=row.insertCell(0);
        var cell1=row.insertCell(1);
        var cell2=row.insertCell(2);

        cell.innerHTML=data.createTime;

        var div=document.createElement("div"),
            span1=document.createElement("span"),
            span2=document.createElement("span");
        span1.innerHTML=data.nickName;
        span2.innerHTML='('+data.uid+')';

        div.appendChild(span1);
        div.appendChild(span2);

        cell1.appendChild(div);


        cell2.innerHTML=data.chatData;
//        cell3.innerHTML=data.fans;
//        cell4.innerHTML=data.income;
//        var a=document.createElement("a");
//        a.href='/anchor/anchorinfo?uid='+data.uid;
//        a.innerHTML="查看";
//        a.className="a-edit font font18 cr-pe cursor-pointer";
//        cell5.appendChild(a);
        return row;
    }
</script>